#set(seoTitle="登录")

<!--必要样式-->
<link href="/assets/login_reg/css/styles.css" rel="stylesheet" type="text/css">
<link href="/assets/login_reg/css/login.css" rel="stylesheet" type="text/css">
<link href="/assets/login_reg/css/loaders.css" rel="stylesheet" type="text/css">
<html>
<body>
<canvas class="pg-canvas" width="1920" height="959"></canvas>
<div class="login">

    <!--<img class="MyLogo" src="loginSpecial/images/logo01.png" alt="   LOGO">-->
    <div class="login_title">
        <span>管理员登录</span>
    </div>
    <form id="login_form" action="/login/doLogin?returnUrl=#(returnUrl)" method="post">
        <div class="login_fields">
            <div class="login_fields__user">
                <div class="icon">
                    <img alt="" src="/assets/login_reg/img/user_icon_copy.png">
                </div>
                <input name="userName" placeholder="邮箱" maxlength="100" class="username" type="text" autocomplete="off">
                <div class="validation">
                    <img alt="" src="/assets/login_reg/img/tick.png">
                </div>
            </div>
            <div class="login_fields__password">
                <div class="icon">
                    <img alt="" src="/assets/login_reg/img/lock_icon_copy.png">
                </div>
                <input name="password" class="passwordNumder" placeholder="密码" maxlength="16" type="password"
                       autocomplete="off">
                <div class="validation">
                    <img alt="" src="/assets/login_reg/img/tick.png">
                </div>
            </div>
            <div class="login_fields__password">
                <div class="icon">
                    <img alt="" src="/assets/login_reg/img/key.png">
                </div>
                <input name="captcha" placeholder="验证码" maxlength="4" class="ValidateNum" style="width: auto;"
                       type="text" autocomplete="off">
                <div class="validation" style="opacity: 1; right: -5px;top: -3px;">
                    <img title="点击刷新" class="J_codeimg captcha" src="/login/captcha" onclick="updateCaptcha();">
                </div>
            </div>
            <div class="login_fields__submit">
                <input type="submit" value="登录">
            </div>
        </div>
    </form>
    <div class="success">
    </div>
</div>


<script type="text/javascript" src="/assets/login_reg/js/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/assets/jquery_form/jquery.form.min.js"></script>
<script type="text/javascript" src="/assets/layer/layer/layer.js"></script>
<link href="/assets/login_reg/layui/css/layui.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/assets/login_reg/js/jquery-ui.min.js"></script>
<script src="/assets/login_reg/layui/layui.js" type="text/javascript"></script>
<script src="/assets/login_reg/js/Particleground.js" type="text/javascript"></script>
<script src="/assets/login_reg/js/jquery.mockjax.js" type="text/javascript"></script>
<script src="/assets/login_reg/js/controlLogin.js" type="text/javascript"></script>

<div class="layui-layer-move"></div>

</body>
</html>

<script type="text/javascript">
    $(document).ready(function () {
        $("#login_form").ajaxForm({
            dataType: "json"
            , beforeSubmit: function (formData, jqForm, options) {       // 表单提交之前回调
                $(".jf-reg-table td span").text("");                                    // 清空所有验证 msg
            }
            , success: function (ret) {
                // 业务层验证成功
                if (ret.state == "ok") {
                    setTimeout(function () {
                        location.href = ret.returnUrl;
                    },100);
                    return;
                }

                // 业务层验证失败
                if (ret.state == "fail") {
                    layer.msg(ret.msg, {
                            shift: 6
                            , shade: 0.3
                            , time: 2500
                            , offset: "165px"
                            , closeBtn: 1
                            , shadeClose: true
                        }, function () {
                            updateCaptcha();
                        }
                    );
                    return;
                }

                // Validator 层验证失败
                if (ret.userNameMsg) {
                    layer.msg(ret.userNameMsg);
                    return;
                }
                if (ret.passwordMsg) {
                    layer.msg(ret.passwordMsg);
                    return;
                }
                if (ret.captchaMsg) {
                    layer.msg(ret.captchaMsg);
                    updateCaptcha();    // captcha 被验证过以后会立即失效，更新之
                    return;
                }
            }
            , error: function (ret) {
            }              // ret.status != 200 时回调
            , complete: function (ret) {
            }       // 无论是 success 还是 error，最终都会被回调
        });
    });

    function updateCaptcha() {
        $(".J_codeimg").attr("src", "/login/captcha?v=" + Math.random());
        $("#captchaInput").val("");
    }
</script>